package com.asiainfo.complier.editor;

import javax.swing.text.Highlighter;
import javax.swing.text.JTextComponent;
import java.awt.*;

public class LineHighter implements Highlighter.HighlightPainter {

	private int dot;
	private int offsetX;

	public LineHighter(int dot, int offsetX) {
		this.dot = dot;
		this.offsetX = offsetX;

	}

	public void paint(Graphics g, int p0, int p1, Shape bounds, JTextComponent c) {
		try {
			if (dot > 0) {
				Rectangle rc = c.modelToView(dot);
				if (rc != null) {
					Rectangle allRc = bounds.getBounds();
					// C4E8FD
					g.setColor(new Color(0xC4, 0xE8, 0xFD));
					g.fillRect(offsetX + 5, rc.y, allRc.width, rc.height);
				}
			}

		} catch (Exception e) {

			e.printStackTrace();
		}

	}
}
